#include "StdAfx.h"
#include "interval_model.h"
#include "vector3d.h"
#include "model_factory.h"


interval_model::interval_model(void)
{
	rise = 0.0f;
	width_position_percent = 1.0f;
	scale = 1.0f;
}


interval_model::~interval_model(void)
{
}

void interval_model::draw_element(float* position, float* delta, float* direction)
{
	float root[3];
	float top[3];
	root[0] = position[0] + width_position_percent*delta[0];
	root[1] = position[1] + width_position_percent*delta[1] + rise;
	root[2] = position[2] + width_position_percent*delta[2];
	
	vector3d root_v3(root);
	vector3d direction_v3(direction);
	direction_v3.y(0.0f);
	vector3d scale_v3(scale, scale, scale);


	model_factory::get_model_factory().draw_model(model_name, root_v3, direction_v3, scale_v3);
	
	root[0] = position[0] - width_position_percent*delta[0];
	root[1] = position[1] - width_position_percent*delta[1] + rise;
	root[2] = position[2] - width_position_percent*delta[2];
	
	root_v3.xyz(root);

	model_factory::get_model_factory().draw_model(model_name, root_v3, direction_v3, scale_v3);
}
